package com.lfy.enumt;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

@AllArgsConstructor
@Getter
public enum testenum {
    No(0,"错误的"),
    YES(2,"是的"),
    ;

    private final Integer status;
    private final String msg;
    private static Map<Integer,String> map ;
    static {
        map = Arrays.stream(testenum.values()).collect(Collectors.toMap(item->item.getStatus(),item->item.getMsg()));
    }

    public static String getMsg(Integer status){
        return map.get(status);
    }
    public static Integer getStatus(Boolean b){
        return b ? YES.getStatus(): No.getStatus();
    }
}
